package com.zoro.barn.business.service.system.business.roleuser.dao;

import com.zoro.barn.commons.db.annotations.MybatisMapper;
import com.zoro.barn.business.service.system.business.roleuser.entity.BarnRoleUser;

import java.util.List;

/**
 * @author zhaoxingwu
 */
@MybatisMapper
public interface BarnRoleUserMapper {
    /**
     * 批量插入
     *
     * @param data data
     */
    void insertBatch(List<BarnRoleUser> data);

    /**
     * if has already hase this one role
     *
     * @param userId user id
     * @param roleId role id
     * @return a number larger than 0 if user has already had this role; otherwise 0
     */
    int haseRole(String userId, String roleId);

    /**
     * delete relations by user id and role id
     *
     * @param roleId role id
     * @param userId user id
     */
    void delete(String roleId, String userId);

    /**
     * 删了角色关联
     * @param roleId roleId
     */
    void deleteByRole(String roleId);
}

